<?php

require_once "utils/Validate.php";

/**
 * useful methods for dealing with email address, including sending of 
 * emails.
 * 
 * @param $to
 * @param $from
 * @param $subject
 * @param $body
 */
class MailUtils{
	
	private $to;
	private $from;
	private $subject;
	private $body;
	
	public function MailUtils($to, $from, $subject, $body){
		
		Validate::notNull($to, "[MailUtils]: email to address is null");
		Validate::notNull($from, "[MailUtils]: email from address is null");
		
		//TODO: validate to, and from emails are valid addresses
		//TODO: html encode subject and body

		$this->to = $to;
		$this->from = $from;
		$this->subject = $subject;
		$this->body = $body;
		
		ini_set("SMTP","relay.prodigynet.co.uk");
    	ini_set("sendmail_from",$from);
    	
//    	$this->send();
	}	
	
	public function send(){
		
		mail($this->to, $this->subject, $this->body);
	}
	
	public static function validEmail($emailAddress){
		
	}
}
?>
